package com.fruit.util;

import java.io.File;
import java.net.URISyntaxException;


public final class FileUtil
{
	public static File loadFile(String filePath)
	{
		return null;
	}
	
	public static File loadFileFromClasspath(String filePath)
	{
		if(filePath.startsWith("classpath"))
			filePath=filePath.substring(filePath.indexOf(":")+1);
		FileUtil.class.getClassLoader().getResource(filePath);
		return null;
	}
	
	public static File loadFileFromCurrentPackage(String filePath)
	{
		if(filePath.startsWith("/"))
			throw new IllegalArgumentException("load file from  CurrentPackage ,the filePath can't starts with '/'");
		try
		{
			Class<?> c=FileUtil.class.getClass();
			return new File(c.getResource(filePath).toURI());
		}
	
		catch (URISyntaxException e)
		{
			throw new RuntimeException(e);
		}
		
	}
	
}
